// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) 
// Source File Name:   ContactUsDialog.java

package com.boci.common.ui.control;

import com.boci.clientapp.main.*;
import com.boci.common.constant.ClientAppConst;
import com.boci.common.ui.AbstractDialog;
import com.boci.common.util.MessagesConfigurator;
import com.boci.common.vo.ResponseVO;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.util.HashMap;
import java.util.Locale;
import javax.swing.*;

public class ContactUsDialog extends AbstractDialog
{

    public ContactUsDialog(TradingClientApp owner, boolean modal, Locale pLocale)
    {
        super(owner, modal, pLocale, true);
        rootPanel = new JPanel();
        lblVersion = new JLabel();
        lblAddress = new JLabel();
        lblAddress1Value = new JLabel();
        lblAddress2Value = new JLabel();
        lblAddress3Value = new JLabel();
        lblPhone = new JLabel();
        lblPhoneValue = new JLabel();
        lblFax = new JLabel();
        lblFaxValue = new JLabel();
        lblEmail = new JLabel();
        lblEmailValue = new JLabel();
        btnClose = new JButton();
        msgConf = ClientAppLoader.getMessagesConfigurator();
        setSize(400, 237);
        initGUI(pLocale);
        setText(pLocale);
    }

    public void setText(Locale pLocale)
    {
        super.setText(pLocale);
        setFont(pLocale);
        setLayout(pLocale);
        lblVersion.setText(msgConf.getUIMessages("CLIENTAPP.VERSION", pLocale));
        lblAddress.setText(msgConf.getUIMessages("CONTACT_US.ADDRESS", pLocale));
        lblAddress1Value.setText(msgConf.getUIMessages("CONTACT_US.ADDRESS1_VALUE", pLocale));
        lblAddress2Value.setText(msgConf.getUIMessages("CONTACT_US.ADDRESS2_VALUE", pLocale));
        lblAddress3Value.setText(msgConf.getUIMessages("CONTACT_US.ADDRESS3_VALUE", pLocale));
        lblPhone.setText(msgConf.getUIMessages("CONTACT_US.PHONE", pLocale));
        lblPhoneValue.setText(msgConf.getUIMessages("CONTACT_US.PHONE_VALUE", pLocale));
        lblFax.setText(msgConf.getUIMessages("CONTACT_US.FAX", pLocale));
        lblFaxValue.setText(msgConf.getUIMessages("CONTACT_US.FAX_VALUE", pLocale));
        lblEmail.setText(msgConf.getUIMessages("CONTACT_US.EMAIL", pLocale));
        lblEmailValue.setText(msgConf.getUIMessages("CONTACT_US.EMAIL_VALUE", pLocale));
        btnClose.setText(msgConf.getUIMessages("CONTACT_US.CLOSE", pLocale));
        setTitle(msgConf.getUIMessages("CONTACT_US.TITLE", pLocale));
    }

    private void setFont(Locale pLocale)
    {
        if(pLocale.equals(ClientAppConst.EN_US))
        {
            lblVersion.setFont(ClientAppLoader.getDisclaimerFont(pLocale));
            lblAddress.setFont(ClientAppLoader.getSmallBoldTextFont(pLocale));
            lblAddress1Value.setFont(ClientAppLoader.getSmallPlainTextFont(pLocale));
            lblAddress2Value.setFont(ClientAppLoader.getSmallPlainTextFont(pLocale));
            lblAddress3Value.setFont(ClientAppLoader.getSmallPlainTextFont(pLocale));
            lblPhone.setFont(ClientAppLoader.getSmallBoldTextFont(pLocale));
            lblPhoneValue.setFont(ClientAppLoader.getSmallPlainTextFont(pLocale));
            lblFax.setFont(ClientAppLoader.getSmallBoldTextFont(pLocale));
            lblFaxValue.setFont(ClientAppLoader.getSmallPlainTextFont(pLocale));
            lblEmail.setFont(ClientAppLoader.getSmallBoldTextFont(pLocale));
            lblEmailValue.setFont(ClientAppLoader.getSmallPlainTextFont(pLocale));
            btnClose.setFont(ClientAppLoader.getPlainButtonFont(pLocale));
        } else
        {
            lblVersion.setFont(ClientAppLoader.getDisclaimerFont(pLocale));
            lblAddress.setFont(ClientAppLoader.getLargeBoldTextFont(pLocale));
            lblAddress1Value.setFont(ClientAppLoader.getLargePlainTextFont(pLocale));
            lblAddress2Value.setFont(ClientAppLoader.getLargePlainTextFont(pLocale));
            lblAddress3Value.setFont(ClientAppLoader.getLargePlainTextFont(pLocale));
            lblPhone.setFont(ClientAppLoader.getLargeBoldTextFont(pLocale));
            lblPhoneValue.setFont(ClientAppLoader.getLargePlainTextFont(pLocale));
            lblFax.setFont(ClientAppLoader.getLargeBoldTextFont(pLocale));
            lblFaxValue.setFont(ClientAppLoader.getLargePlainTextFont(pLocale));
            lblEmail.setFont(ClientAppLoader.getLargeBoldTextFont(pLocale));
            lblEmailValue.setFont(ClientAppLoader.getLargePlainTextFont(pLocale));
            btnClose.setFont(ClientAppLoader.getPlainButtonFont(pLocale));
        }
        lblVersion.setHorizontalAlignment(4);
        lblAddress.setHorizontalAlignment(4);
        lblPhone.setHorizontalAlignment(4);
        lblFax.setHorizontalAlignment(4);
        lblEmail.setHorizontalAlignment(4);
    }

    public void setLayout(Locale pLocale)
    {
        int y = 30;
        String strAddr3Value = null;
        lblVersion.setBounds(25, 0, 355, 20);
        lblAddress.setBounds(25, y, 70, 20);
        lblAddress1Value.setBounds(109, y, 250, 20);
        lblAddress2Value.setBounds(109, y += 15, 250, 20);
        strAddr3Value = msgConf.getUIMessages("CONTACT_US.ADDRESS3_VALUE", pLocale);
        if(strAddr3Value != null && !strAddr3Value.trim().equals(""))
        {
            lblAddress3Value.setBounds(109, y += 15, 250, 20);
            lblAddress3Value.setVisible(true);
        } else
        {
            lblAddress3Value.setVisible(false);
        }
        lblPhone.setBounds(25, y += 20, 70, 20);
        lblPhoneValue.setBounds(109, y, 250, 20);
        lblFax.setBounds(25, y += 20, 70, 20);
        lblFaxValue.setBounds(109, y, 250, 20);
        lblEmail.setBounds(25, y += 20, 70, 20);
        lblEmailValue.setBounds(109, y, 250, 20);
        btnClose.setBounds(135, y += 30, 120, 25);
    }

    public void initGUI(Locale pLocale)
    {
        rootPanel.setLayout(null);
        rootPanel.setBackground(Color.WHITE);
        getContentPane().setLayout(new BorderLayout());
        getContentPane().add(rootPanel, "Center");
        setLayout(pLocale);
        rootPanel.add(lblVersion);
        rootPanel.add(lblAddress);
        rootPanel.add(lblAddress1Value);
        rootPanel.add(lblAddress2Value);
        rootPanel.add(lblAddress3Value);
        rootPanel.add(lblPhone);
        rootPanel.add(lblPhoneValue);
        rootPanel.add(lblFax);
        rootPanel.add(lblFaxValue);
        rootPanel.add(lblEmail);
        rootPanel.add(lblEmailValue);
        rootPanel.add(btnClose);
        btnClose.setActionCommand("CNTUS_CLOSE");
        btnClose.addActionListener(this);
    }

    public void refresh(ResponseVO pResponseVO)
    {
        setDefFocus();
    }

    public void actionPerformed(ActionEvent e)
    {
        String strActionType = e.getActionCommand();
        ApplicationService appServ = ApplicationService.getInstance();
        if(strActionType.equals("CNTUS_CLOSE"))
            appServ.showContactUsDialog(false);
    }

    public HashMap getInputValue(String pActionType)
    {
        return null;
    }

    public void setDefFocus()
    {
        SwingUtilities.invokeLater(new Runnable() {

            public void run()
            {
                btnClose.requestFocus();
            }
        }
);
    }

    private JPanel rootPanel;
    private JLabel lblVersion;
    private JLabel lblAddress;
    private JLabel lblAddress1Value;
    private JLabel lblAddress2Value;
    private JLabel lblAddress3Value;
    private JLabel lblPhone;
    private JLabel lblPhoneValue;
    private JLabel lblFax;
    private JLabel lblFaxValue;
    private JLabel lblEmail;
    private JLabel lblEmailValue;
    private JButton btnClose;
    private MessagesConfigurator msgConf;

}
